/**
 * 
 */
package com.base.myproject.server.ratify;

import com.base.myproject.server.database.PoolMan;

/**
 * 对数据库的审批
 * @author zgw
 *2009-11-29 下午12:41:36
 * javazgw@gmail.com
 */
public class RatifyJDBC extends RatifyObject{
	
	public RatifyJDBC(String ratifycode,String busiinnercode)
	{
		super(ratifycode,busiinnercode);
	}
	/**
	 * 审批通过
	 * @return
	 */
	protected boolean ratify()
	{
		if(isIsfollow())
		{
		PoolMan pm = new PoolMan();
		String sql =" update ratifydetail set ratifystatus=1 where busicode='"+ratifycode+"' and busiinnercode='"+busiinnercode+"' and code='"+code+"'";
		
		
		try {
			return pm.Update(sql)>0?true:false;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		finally
		{
			try {
				pm.close("test");
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		}
	//	super.ratify();
		return false;
	}
	/**
	 * 审批不通过
	 * @return
	 */
	protected boolean ratifyFalse()
	{
		super.ratifyFalse();
		
		return true;
	}
/**
 * 审批保留意见
 * @return
 */

	protected boolean ratifyWaiting()
	{
		super.ratifyWaiting();
		return false;
	}
	/**
	 * 取消审批
	 * @return
	 */
	protected boolean ratifyCancel()
	{
		super.ratifyCancel();
		return true;
	}
	
	public void setIsfollow(boolean isfollow) {
		
		
		super.setIsfollow(isfollow);
		
		PoolMan pm = new PoolMan();
		String insql = "insert into ratifydetail(ratifyicode,busicode,ratifybcode,bcode,fromstatus,tostatus,ratifystatus,busiinnercode)";
//		insql += " values('" + ratifyicode + "','" + busicode2 + "','"
//				+ tobcode + "','" + bcode2 + "','" + fromstatus2 + "','"
//				+ tostatus2 + "','" + Status.RATIFYSTATUS_WAIT + "','"+busiinfo.getIcode()+"')";
//
//		
		System.out.println(insql);
		
	}

}
